package com.gitee.maskit.nop.autoconfigure;

import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;

import java.lang.reflect.Method;

@Lazy
@Configuration
public class NopAutoConfiguration {

    @Bean
    public BeanFactoryPostProcessor nopBeanFactoryPostProcessor() {
        return new NopBeanFactoryPostProcessor();
    }

    @Bean
    @ConditionalOnMissingBean
    public NopProvider nopProvider() {
        return new NopProvider() {
            public <T> T apply(Method method, Object... arguments) {
                return null;
            }
        };
    }
}
